1. /* factfigs.cpp by K.Tsuru */
  2. /************************************
  3. It returns the figures of factorial n! in a decimal system
  4. by the Stirling's formula.
  5. *************************************/
  6. #include <cmath>
  7. #ifndef DEF_CONST_H
  8. #include "defconst.h"
  9. #endif
  10. unsigned long Stirling(unsigned long n){ // ver. 2.17.1 change into "unsigned long"
  11. static double C1 = 0.5*log10(2*M_PI) +1.0, C2 = log10(M_E);
  12. if(n < 4) return 1; // <= 3! = 6
  13. double N = n, f = C1 - C2*N + (N + 0.5)*log10(N);
  14. return (unsigned long)f;
  15. }

factfigs.cpp : last modifiled at 2015/10/23 16:15:58(537 bytes)
created at 2016/04/11 11:17:20
The creation time of this html file is 2017/10/07 10:54:15 (Sat Oct 07 10:54:15 2017).